import request from '@/config/axios'

// 送货单 VO
export interface OrderDeliveryVO {
  id: string // ID
  asnCode: string // 送货单编码
  remark: string // 备注
}

// 送货单 API
export const OrderDeliveryApi = {
  // 查询送货单分页
  getOrderDeliveryPage: async (params: any) => {
    return await request.get({ url: `/ck/order-delivery/page`, params })
  },

  // 查询送货单详情
  getOrderDelivery: async (id: number) => {
    return await request.get({ url: `/ck/order-delivery/get?id=` + id })
  },

  // 新增送货单
  createOrderDelivery: async (data: OrderDeliveryVO) => {
    return await request.post({ url: `/ck/order-delivery/create`, data })
  },

  // 修改送货单
  updateOrderDelivery: async (data: OrderDeliveryVO) => {
    return await request.put({ url: `/ck/order-delivery/update`, data })
  },

  // 删除送货单
  deleteOrderDelivery: async (id: number) => {
    return await request.delete({ url: `/ck/order-delivery/delete?id=` + id })
  },

  // 导出送货单 Excel
  exportOrderDelivery: async (params) => {
    return await request.download({ url: `/ck/order-delivery/export-excel`, params })
  },

// ==================== 子表（送货单明细） ====================

  // 获得送货单明细列表
  getOrderDeliveryDetailListByMainId: async (mainId) => {
    return await request.get({ url: `/ck/order-delivery/order-delivery-detail/list-by-main-id?mainId=` + mainId })
  },
}